/**
 * Created by C503 on 2015/5/6.
 */

/*var ctx= cvs.getContext("2d");
ctx.moveTo(0,0);
ctx.moveTo(200,100);
ctx.stroke();*/

/*
CanvasRenderingContext2D.prototype.onePixelLineTo = function(fromX, fromY, toX, toY, backgroundColor, vertical) {
    var currentStrokeStyle = this.strokeStyle;
    this.beginPath();
    this.moveTo(fromX, fromY);
    this.lineTo(toX, toY);
    this.closePath();
    this.lineWidth=2;
    this.stroke();
    this.beginPath();
    if(vertical) {
        this.moveTo(fromX+1, fromY);
        this.lineTo(toX+1, toY);
    } else {
        this.moveTo(fromX, fromY+1);
        this.lineTo(toX, toY+1);
    }
    this.closePath();
    this.lineWidth=2;
    this.strokeStyle=backgroundColor;
    this.stroke();
    this.strokeStyle = currentStrokeStyle;
};
*/
var drawer={
    getCanvasEl:function(id){
        var cvs=document.getElementById("myCanvas");
        return cvs;
    },
    getContextBy2D:function(canvas){
        return canvas.getContext("2d");
    }
};
(function(){
    var cvs=document.getElementById("myCanvas");
/*    console.log(cvs);
    for(var item in cvs){
        console.log(item)
    }*/
    var ctx= cvs.getContext("2d");
    ctx.save();
    ctx.translate(0.5,0.5);
    ctx.lineWidth=1;
    ctx.beginPath();
     ctx.moveTo(20,0);
     ctx.lineTo(20,40);
    ctx.lineTo(80,40);
    ctx.lineTo(120,60);
     //console.log(Math.round(cvs.width)+"__"+Math.round(cvs.height));
     //ctx.lineTo(Math.round(cvs.width),Math.round(cvs.height));

     ctx.stroke();
    ctx.restore();

    ctx.save();
    ctx.translate(0.5,0.5);
    ctx.lineWidth = 1;
    ctx.beginPath();
    ctx.moveTo(10, 100);
    ctx.lineTo(300,100);
    ctx.stroke();
    ctx.restore();
    /*ctx.beginPath();
    ctx.arc(95,50,40,0,2*Math.PI);
    ctx.stroke();

    ctx.beginPath();
    ctx.arc(65,30,20,0,2*Math.PI);
    ctx.stroke();

    ctx.font="30px Arial";
    ctx.fillText("Hello World",10,50);

    ctx.font="30px Arial";
    ctx.strokeText("Hello World",40,150);*/
}());

